﻿using System.Collections.Generic;

namespace K9Nano.Authorization;

public sealed class PermissionEqualityComparer : IEqualityComparer<Permission>
{
    bool IEqualityComparer<Permission>.Equals(Permission? x, Permission? y)
    {
        if (x == null && y == null) return true;
        if (x == null || y == null) return false;
        return x.Name.Equals(y.Name, StringComparison.Ordinal);
    }

    int IEqualityComparer<Permission>.GetHashCode(Permission obj)
    {
        return obj.Name.GetHashCode();
    }
}